window.FS = window.FS || {}; window.FS.Vidyard = { getJwt: function(uuid, callback, options){ if(!uuid){ callback(new Error("No uuid provided")); }else{ if(uuid.indexOf('//') < 0){ //this means we weren't provided an internalId and //therefore can't create a JWT. This isn't an error, //just a situration that the invoker needs to deal with callback(null, {uuid: uuid}); }else{ options = options || {}; var uuidParts = uuid.split("//"); var internalId = uuidParts[0]; uuid = uuidParts[1]; var xhr = $.post((options.domain || '') + '/alt/apps/fshr/shared/vidyardJwt', $.extend({player_uuid: uuid, internalId: internalId}, options.payload || {})); xhr.then(function(data, statusText, error){ callback(statusText === 'success' ? null : error, {jwt: data.jwt, uuid: uuid}); }); } } } };